package com.geping.etl.common.repository;

import com.geping.etl.common.entity.CmdTaskConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface CmdTaskConfigRepository extends JpaRepository<CmdTaskConfig,Integer>, JpaSpecificationExecutor<CmdTaskConfig> {

	 @Query("from CmdTaskConfig")
	// @Query("select su.subjectName from CmdTaskConfig s,Sys_Subject where s.subject = su.id ")
	CmdTaskConfig getPath();

	//修改
	@Modifying
	@Transactional
	@Query("update CmdTaskConfig c set c.name = ?1,c.task = ?2,c.odspath = ?3,c.data_data = ?4 where c.id = ?5")
	Integer update(String name, String task, String odspath,String data_data, Integer id);


	// 删除
	 @Modifying
	 @Transactional
	// @Query("update CmdTaskConfig e set e.name = ?1,e.task = ?2,e.odspath = ?3 where e.id = ?4")
	 @Query("delete from CmdTaskConfig where id in(?1)")
	// @Query("delete from CmdTaskConfig where id in(?1)")
	Integer deleteByIds(List<Integer> ids);



}
